/* Holly Beach & Liviu Patrasco
 *  cpu.h
 *  Created on: Feb 25, 2012
 */

#ifndef CPU_H_
#define CPU_H_

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "process.h"
#include "scheduler.h"
#include <pthread.h>
#define MAX_PROCESSES 20
#define MAX_MEMORY_VALUE 15
enum exitcode {timerInt, sysCall, calcIOInterrupt, kbIOInterrupt};
void initializeCPU(process procs[20], int numProcess, char schedPolicy);
void runCPU();
void timerSwitch();
void contextSwitch();
enum exitcode runUIProcess();
enum exitcode runCalcProcess();
enum exitcode runProducerProcess();
enum exitcode runConsumerProcess();
void wakeUpProcesses();
int memorySemaphoreUp();
int memorySemaphoreDown();
void printProcessStates();
void startth();

#endif /* CPU_H_ */
